import { defineStore } from 'pinia';

interface IMsgItem {
	label: string;
	value: string;
	time: string;
}

export const useMsgStore = defineStore('msg', () => {
	const msgArray = ref<IMsgItem[]>([]);

	function getAllMsg() {
		return msgArray.value;
	}

	function setMsg(value: IMsgItem) {
		msgArray.value.push(value);
	}

	function removeAll() {
		msgArray.value = [];
	}

	return { msgArray, getAllMsg, setMsg, removeAll };
});
